package com.ruoyi.labdata.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.labdata.domain.LabReservationParameterPersonnel;
import com.ruoyi.labdata.mapper.LabReservationParameterPersonnelMapper;
import com.ruoyi.labdata.service.ILabFileService;
import com.ruoyi.labdata.service.ILabReservationParameterPersonnelService;
import com.ruoyi.system.utils.FileTypeEnum;

/**
 * 预约及参数人员Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-29
 */
@Service
public class LabReservationParameterPersonnelServiceImpl implements ILabReservationParameterPersonnelService 
{

    private static final String belongType = FileTypeEnum.LabBlack.getValue();;

    @Resource
    private LabReservationParameterPersonnelMapper labReservationParameterPersonnelMapper;

    @Autowired
    private ILabFileService labFileService;


    /**
     * 查询预约及参数人员
     * 
     * @param id 预约及参数人员ID
     * @return 预约及参数人员
     */
    @Override
    public LabReservationParameterPersonnel selectLabReservationParameterPersonnelById(Long id)
    {
        return labReservationParameterPersonnelMapper.selectLabReservationParameterPersonnelById(id);
    }

    /**
     * 查询预约及参数人员列表
     * 
     * @param labReservationParameterPersonnel 预约及参数人员
     * @return 预约及参数人员
     */
    @Override
    public List<LabReservationParameterPersonnel> selectLabReservationParameterPersonnelList(LabReservationParameterPersonnel labReservationParameterPersonnel)
    {
        return labReservationParameterPersonnelMapper.selectLabReservationParameterPersonnelList(labReservationParameterPersonnel);
    }

    /**
     * 新增预约及参数人员
     * 
     * @param labReservationParameterPersonnel 预约及参数人员
     * @return 结果
     */
    @Override
    public int insertLabReservationParameterPersonnel(LabReservationParameterPersonnel labReservationParameterPersonnel)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        labReservationParameterPersonnel.setCreateUserId(user.getUserId());
        labReservationParameterPersonnel.setCreateTime(new Date());
        int ret = labReservationParameterPersonnelMapper.insertLabReservationParameterPersonnel(labReservationParameterPersonnel);
        return ret;
    }

    /**
     * 修改预约及参数人员
     * 
     * @param labReservationParameterPersonnel 预约及参数人员
     * @return 结果
     */
    @Override
    public int updateLabReservationParameterPersonnel(LabReservationParameterPersonnel labReservationParameterPersonnel)
    {
        return labReservationParameterPersonnelMapper.updateLabReservationParameterPersonnel(labReservationParameterPersonnel);
    }

    /**
     * 批量删除预约及参数人员
     * 
     * @param ids 需要删除的预约及参数人员ID
     * @return 结果
     */
    @Override
    public int deleteLabReservationParameterPersonnelByIds(Long[] ids)
    {
        return labReservationParameterPersonnelMapper.deleteLabReservationParameterPersonnelByIds(ids);
    }

    /**
     * 删除预约及参数人员信息
     * 
     * @param id 预约及参数人员ID
     * @return 结果
     */
    @Override
    public int deleteLabReservationParameterPersonnelById(Long id)
    {
        return labReservationParameterPersonnelMapper.deleteLabReservationParameterPersonnelById(id);
    }

    /**
     * 删除预约及参数人员信息
     *
     * @param labReservationId 预约ID
     * @return 结果
     */
    @Override
    public void deleteLabReservationParameterPersonnelByLabReservationId(Long[] labReservationId) {
         labReservationParameterPersonnelMapper.deleteLabReservationParameterPersonnelByLabReservationId(labReservationId);
    }
}
